#include "TestResultDebugOut.h"
#include "Failure.h"
#include <iostream>
#include <sstream>
//#include <windows.h>

using namespace std;


void TestResultDebugOut::startTests ()
{
    cout << "\n\nRunning unit tests...\n\n";
}


void TestResultDebugOut::addFailure (const Failure & failure) 
{
    TestResult::addFailure(failure);

    std::ostringstream oss;
    oss << failure;
    cout << oss.str().c_str() << endl;    
}

void TestResultDebugOut::endTests () 
{
    TestResult::endTests();

    std::ostringstream oss;
    oss << testCount << " tests run" << std::endl;
    if (failureCount > 0){
        oss << "****** There were " << failureCount << " failures.";
    }
    else{
        oss << "There were no test failures.";
    }
    oss << "(time: " << secondsElapsed << " s)" << std::endl;

    cout << oss.str().c_str() << endl;
    
}
